package com.example;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;


public class MailReaderBroadcast extends BroadcastReceiver {



    @Override
    public void onReceive(Context context, Intent intent) {

        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");


         if (intent.getAction().equals("test")) {
             ServiceConnection connection = (ServiceConnection) intent.getExtras().getSerializable("connection");

             System.out.println("!!!!!!!!!!!!!!!!!!  INTENT RECEIVED    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            //context.startService(new Intent(context, MailReaderService.class));
             context.bindService(intent, connection, Context.BIND_AUTO_CREATE);
         }



    }

}


/*

String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);

        int icon = R.drawable.mail;
CharSequence tickerText = "Hello";
long when = System.currentTimeMillis();

Notification notification = new Notification(icon, tickerText, when);


CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";

PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent, 0);

notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

        mNotificationManager.notify(1, notification);

*/